package com.zf.bm.common.core.sys.service;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.zf.bm.common.core.base.service.BaseService;
import com.zf.bm.common.core.sys.dao.SysUserCertDao;
import com.zf.bm.common.core.sys.entity.SysUserCert;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * <p>
 * 用户-证书表 服务实现类
 * </p>
 *
 * @author guojing
 * @since 2023-08-04
 */
@DS("master")
@Service
@Transactional(readOnly = true)
public class SysUserCertService extends BaseService<SysUserCertDao, SysUserCert> {

    /**
     * 查询证书cert与用户对应关系
     *
     * @return
     */
    public List<SysUserCert> findCertNameList() {
        return list(new LambdaQueryWrapper<SysUserCert>()
                .select(SysUserCert::getCert, SysUserCert::getLoginName)
                .orderByAsc(SysUserCert::getUserId));
    }
}
